import {Base} from '../utils/base.js';

class Sysmsg extends Base {
    constructor() {
        super();
    }


    GetsysmsgList(callback, params) {
        var that = this;
        var param = {
            url: 'v1.Sysmsg/getSysmsgList',
            type: 'post',
            data: params,
            sCallback: function (data) {
                data = data;
                callback && callback(data);
            }
        };
        this.request(param);
    }

    newGetsysmsgList(callback, params) {
        var that = this;
        var param = {
            url: this.res + '/api/chat/msglist',
            type: 'post',
            data: params,
            setUpUrl: false,
            sCallback: function (data) {
                data = data;
                callback && callback(data);
            }
        };
        this.request(param);
    }

    sendSysmsg(callback, params) {
        var that = this;
        var param = {
            url: this.res + '/api/chat/send',
            type: 'post',
            data: params,
            setUpUrl: false,
            sCallback: function (data) {
                data = data;
                callback && callback(data);
            }
        };
        this.request(param);
    };

    sendDel(callback, params) {
        var that = this;
        var param = {
            url: this.res + '/api/chat/del',
            type: 'post',
            data: params,
            setUpUrl: false,
            sCallback: function (data) {
                data = data;
                callback && callback(data);
            }
        };
        this.request(param);
    };

    getHistorySysmsg(callback, params) {
        var that = this;
        var param = {
            url: this.res + '/api/chat/send',
            type: 'post',
            data: {
                ...params,
                message_type: 4
            },
            setUpUrl: false,
            sCallback: function (data) {
                data = data;
                callback && callback(data);
            }
        };
        this.request(param);
    };

    toRedById(callback, params) {
        var that = this;
        var param = {
            url: this.res + '/api/chat/read',
            type: 'post',
            data: {
                ...params,
            },
            setUpUrl: false,
            sCallback: function (data) {
                data = data;
                callback && callback(data);
            }
        };
        this.request(param);
    };
    // 收藏
    sendCollect(callback, params) {
        var that = this;
        var param = {
            url: this.res + 'api/chat/collect',
            type: 'post',
            data: params,
            setUpUrl: false,
            sCallback: function (data) {
                data = data;
                callback && callback(data);
            }
        };
        that.request(param);
    }
    Updatesysmsg(callback, params) {
        var that = this;
        var param = {
            url: 'v1.Sysmsg/updateSysmsg',
            type: 'post',
            data: params,
            sCallback: function (data) {
                data = data;
                callback && callback(data);
            }
        };
        this.request(param);
    }




};

export {Sysmsg};
